home *** CD-ROM | disk | FTP | other *** search
- /*
- ** getinfo.c
- **
- ** ANSI-C implementation of the WarpOS tool "showinfo".
- **
- ** V1.0 24-May-98 phx
- ** created
- */
-
- #include <stdio.h>
- #include <utility/tagitem.h>
- #include <powerpc/powerpc.h>
- #include <powerpc/tasksPPC.h>
- #include <clib/powerpc_protos.h>
-
-
- static char *cpu_names[] = {
- "unknown","603","603e","604","604e","620"
- };
-
- static char *cache1[2] = {
- "on","off"
- };
-
- static char *cache2[2] = {
- "locked","unlocked"
- };
-
-
-
- main()
- {
- static ULONG tags[] = {
- GETINFO_CPU,0,
- GETINFO_PVR,0,
- GETINFO_ICACHE,0,
- GETINFO_DCACHE,0,
- GETINFO_PAGETABLE,0,
- GETINFO_TABLESIZE,0,
- GETINFO_BUSCLOCK,0,
- GETINFO_CPUCLOCK,0,
- GETINFO_CPULOAD,0,
- GETINFO_SYSTEMLOAD,0,
- TAG_DONE
- };
- int cpu = 0;
-
- GetInfo((struct TagItem *)tags);
-
- /* print PowerPC infos */
- if (tags[1] & CPUF_603) cpu = 1;
- if (tags[1] & CPUF_603E) cpu = 2;
- if (tags[1] & CPUF_604) cpu = 3;
- if (tags[1] & CPUF_604E) cpu = 4;
- if (tags[1] & CPUF_620) cpu = 5;
-
- printf("CPU:\t\t\tPowerPC %s (PVR = %08lx)\n"
- "CPU clock:\t\t%ld.%06ld MHz\n"
- "Bus clock:\t\t%ld.%06ld MHz\n"
- "Instruction cache:\t%s and %s\n"
- "Data cache:\t\t%s and %s\n"
- "Page table location:\t0x%08lx\n"
- "Page table size:\t%ld KBytes\n"
- "Cpu load:\t\t%ld.%02ld%%\n"
- "System load:\t\t%ld.%02ld%%\n",
- cpu_names[cpu],tags[3],
- tags[15]/1000000,tags[15]%1000000,tags[13]/1000000,tags[13]%1000000,
- cache1[(tags[5]&2)>>1],cache2[tags[5]&1],
- cache1[(tags[7]&2)>>1],cache2[tags[7]&1],tags[9],tags[11],
- tags[17]/100,tags[17]%100,tags[19]/100,tags[19]%100);
- }
-